package com.mygdx.game_objects;

import com.badlogic.gdx.math.Circle;
import com.badlogic.gdx.math.Vector2;

public class Eggs {

	private Vector2 velocity;
	private Vector2 position;
	private Vector2 acceleration;
	private boolean isFallOut;
	private Circle eggShape;
	private float radius;
	private int gameHeight;
	private boolean shit = false;
	private boolean isCatched = false;
	public static float fallSpeed = 30;
	private int width;
	private int height;
	
	public Eggs(float x, float y, float radius, int width, int height, int gameHeight) {
		position = new Vector2(x, y);
		velocity = new Vector2(0, fallSpeed);
		acceleration = new Vector2(0, 200);
		isFallOut = false;
		eggShape = new Circle(x, y, radius);
		this.gameHeight = gameHeight;
		this.radius = radius;
		if ((int)(Math.random() * 3) == 0) {
			shit = true;
		}
		this.width = width;
		this.height = height;
	}
	
	public void update (float delta) {
		velocity.add(acceleration.cpy().scl(delta));
		position.add(velocity.cpy().scl(delta));
		
		if (position.y > gameHeight) {
			isFallOut = true;
		}
		eggShape.set(position.x, position.y, radius);
	}
	
	public void stop() {
		velocity.y = 0;
	}

	public boolean isFallOut() {
		return isFallOut;
	}
	
	public float getX() {
		return position.x;
	}
	
	public float getY() {
		return position.y;
	}

	public float getRadius() {
		return radius;
	}

	public boolean isShit() {
		return shit;
	}

	public Circle getEggShape() {
		return eggShape;
	}

	public boolean isCatched() {
		return isCatched;
	}

	public void setCatched(boolean isCatched) {
		this.isCatched = isCatched;
	}

	public float getFallSpeed() {
		return fallSpeed;
	}

	public int getWidth() {
		return width;
	}

	public int getHeight() {
		return height;
	}
	
}
